package com.mjh.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mjh.bean.Customer;
import com.mjh.mapper.CustomerMapper;
import com.mjh.model.BaseQuery;
import com.mjh.service.CustomerService;
import com.mjh.vo.CustomerVo;
import com.mjh.vo.CustomerVoo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomerServiceImpl implements CustomerService {
    @Autowired
    private CustomerMapper customerMapper;
    @Override
    public PageInfo<CustomerVo> queryCustomerListByPage(Integer current, Integer size) {
        PageHelper.startPage(current,size);
        List<CustomerVo> list = customerMapper.selectList(new BaseQuery());
        return new PageInfo<>(list);
    }

    @Override
    public Boolean removeCustomerById(Integer id) {
        return customerMapper.deleteByPrimaryKey(Long.valueOf(id))>0;
    }

    @Override
    public List<CustomerVoo> queryAllCustomerList() {
        return customerMapper.selectAllCustomerList(new BaseQuery());
    }
}
